package com.ppx.life.common.client;

import com.ppx.life.dao.vo.Conversation;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Conversation doHandleRuntimeException(
            RuntimeException e){
        e.printStackTrace();//也可以写日志
        return new Conversation(e);//封装异常信息
    }
}
